<%--
  Created by IntelliJ IDEA.
  User: 杨麟
  Date: 2022/2/17
  Time: 17:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>修改用户信息</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/bootstrap.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.4.1.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap.js"></script>
    <script>
        function $(id) {
            return document.getElementById(id)
        }
        function check() {
            var ouserName = $("userName")
            if(ouserName.value==''){
                alert("用户名不能为空！")
                return false
            }
            return true
        }
    </script>
</head>
<body>
<div class="col-md-4">
    <form action="${pageContext.request.contextPath}/ServletMain?cmd=update" class="form-group" method="post" onsubmit="return check()">
        <table class="table table-bordered">
            <tr>
                <th colspan="2" scope="col">用户信息修改</th>
            </tr>
            <input type="hidden" name="id" value="${user.id}">;
            <tr>
                <td>用户名</td>
                <td><input name="userName" class="form-control" type="text" id="userName" value="${user.userName}"/></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input name="userPwd"  class="form-control" type="password" id="userPwd" value="${user.userPwd}"/></td>
            </tr>
            <tr>
                <td>性别</td>
                <td>
                    <div class="radio-inline">
                        <input type="radio" name="sex" value="男" <c:if test="${user.sex == '男'}">checked</c:if> /> 男
                    </div>
                    <div class="radio-inline">
                        <input type="radio" name="sex" value="女" <c:if test="${user.sex == '女'}">checked</c:if> /> 女
                    </div>
                </td>
            </tr>
            <tr>
                <td>爱好</td>
                <td><input name="chk" type="checkbox" id="chk1" value="书法" />
                    书法 <input name="chk" type="checkbox" id="chk2" value="舞蹈" /> 舞蹈 <input
                            name="chk" type="checkbox" id="chk3" value="音乐" /> 音乐 <input
                            name="chk" type="checkbox" id="chk4" value="绘画" /> 绘画 <input
                            name="chk" type="checkbox" id="chk5" value="游泳" /> 游泳</td>
            </tr>
            <tr>
                <td>学历</td>
                <td><select name="sel"  class="form-control" id="sel">
                    <option value="null" >====请选择====</option>
                    <c:forEach items="${Education}" var="education" >
                        <option value="${education.eid}" <c:if test="${user.sel == education.eid}">selected</c:if>>
                                ${education.ename}</option>
                    </c:forEach>
                </select></td>
            </tr>
            <tr>
                <td>家庭住址</td>
                <td><textarea class="form-control" name="address" cols="50" rows="10" id="address" >${user.address}</textarea></td>
            </tr>
            <tr>
                <td>生日</td>
                <td><input type="date" class="form-control" name="birthday" id="birthday" value="${user.birthday}"></td>
            </tr>
            <tr>
                <td colspan="2" align="center"><input type="submit" class="btn btn-success" name="Submit" value="提交信息" />
                    <input type="reset" class="btn btn-info" name="Submit2" value="重置" /></td>
            </tr>
        </table>
    </form>
</div>

</body>
</html>
